package simple_factory

import "fmt"

type Animal interface {
	Call()
}

type dog struct {
}

func (*dog) Call() {
	fmt.Println("汪汪汪...")
}

type cat struct {

}

func (*cat) Call() {
	fmt.Println("喵喵喵...")
}

// 简单工厂方法，根据类型来创建具体的动物
func NewAnimal(kind string) Animal {
	switch kind {
	case "dog":
		return &dog{}
	case "cat":
		return &cat{}
	}
	return nil
}
